@charset "UTF-8";

// 清除浮动
@mixin clearfix() {
  &:before,
  &:after {
    content: "";
    display: table;
  }
  &:after {
    clear: both;
    overflow: hidden;
  }
}

// 动画
@mixin animation($params) {
  $name: first($params);
  animation: $params;
  @keyframes #{$name} {
    @content;
  }
}

// 浮动
@mixin float($direction: left, $support-ie: false) {
  float: unquote($direction);
  @if $support-ie {
    _display: inline;
  }
}

/**
 * @param $line       超出显示省略号的行数，默认：1
 * @param $substract  为预留区域百分比%，默认：0
 */
@mixin text-overflow($line: 1, $substract: 0) {
  overflow: hidden;
  @if $line==1 {
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 100% - $substract;
  } @else {
    display: -webkit-box;
    -webkit-line-clamp: $line;
    -webkit-box-orient: vertical;
  }
}

/**
 * 线中间夹文字效果
 * @param $height  线高  default: 1px
 * @param $space   线距离文字两边的距离 default: 0.5em
 * @param $color   线颜色 default: inherit
 * @param $style   border-style default: solid
 * @param $adjust  线距离底部的距离，默认垂直居中 default: false
 * @param $double  是否需要两条线
 */
@mixin side-line($height: 1px, $space: 0.5em, $color: inherit, $style: solid, $adjust: false, $double: false) {
  display: block;
  overflow: hidden;
  text-align: center;
  &:before,
  &:after {
    content: "";
    display: inline-block;
    vertical-align: middle;
    position: relative;
    width: 50%;
    border-top-style: $style;
    border-top-width: $height;
    @if $color !=inherit {
      border-top-color: $color;
    }
    @if $adjust !=false {
      bottom: $adjust;
    }
    @if $double !=false {
      height: $double;
      border-bottom-style: $style;
      border-bottom-width: $height;
      @if $color !=inherit {
        border-bottom-color: $color;
      }
    }
  }
  &:before {
    right: $space;
    margin-left: -50%;
  }
  &:after {
    left: $space;
    margin-right: -50%;
  }
}

// box-sizing
@mixin box-sizing($type: border-box) {
  -webkit-box-sizing: $type;
  -moz-box-sizing: $type;
  box-sizing: $type;
  @at-root {
    *,
    *:before,
    *:after {
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
    }
  }
}
